/**
 * 
 */
package testcases;

import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;

import com.trentech.billcalc.FinanceManager;
import com.trentech.billcalc.event.*;


/**
 * @author marieputri
 *
 */
public class EventData {
    public static void SaveEvent(FinanceManager fm, Event ev)
    {
        // fm is an instance of FinanceManager that will process saving event ev
        
        try {
            int eventNum = fm.getEvents().size();
            fm.resortEvents();
            fm.addEvent(ev);
            fm.resortEvents();
            //fm.processEvents();
            fm.saveEvents();
            assertTrue(eventNum <= fm.getEvents().size());
        }
        catch (Exception ex) {
            //System.out.println("SaveEventTest>SaveEvent : " + ex.getMessage());
        }
    }
    
    
    public EventData()
    {
    	Generate_ArriveEvent();
    	Generate_BillEvent();
    	Generate_LeaveEvent();
    	Generate_OptInEvent();
    	Generate_OptOutEvent();
    	Generate_PayEvent();
    	Generate_RenewLeaseEvent();
    	Generate_SetupBillEvent();
    	Generate_StartLeaseEvent();
    	Generate_StartVacationEvent();
    	Generate_StopVacationEvent();
    	Generate_TransferLeaseEvent();
    }
    
    
    public static List<ArriveEvent> ListArrive;
        
    private void Generate_ArriveEvent ()
    {
    	ListArrive = new ArrayList<ArriveEvent>();
    	
    	// Add objects
    	ListArrive.add(new ArriveEvent(MainTest.addDays(-10), "Marie Putri"));
    	ListArrive.add(new ArriveEvent(MainTest.addDays(-3), "Alya"));
    	ListArrive.add(new ArriveEvent(MainTest.addDays(-2), "Jessa"));
    	ListArrive.add(new ArriveEvent(MainTest.addDays(11), "Lappie"));
    	ListArrive.add(new ArriveEvent(MainTest.addDays(4), "Nexia"));
    }
    
    
    public static List<BillEvent> ListBill;
    
    private void Generate_BillEvent ()
    {
    	ListBill = new ArrayList<BillEvent>();
    	
    	// Add objects
    	ListBill.add(new BillEvent(MainTest.addDays(1), "Gass Bill", 12000));
    	ListBill.add(new BillEvent(MainTest.addDays(6), "Gass Bill", 15000));
    	ListBill.add(new BillEvent(MainTest.addDays(10), "Telephone Bill", 12000));
    	ListBill.add(new BillEvent(MainTest.addDays(11), "Gass Bill", 9000));
    }
    
    
    public static List<LeaveEvent> ListLeave;
    
    private void Generate_LeaveEvent ()
    {
    	ListLeave = new ArrayList<LeaveEvent>();
    	
    	// Add objects
    	ListLeave.add(new LeaveEvent(MainTest.addDays(20), "Alya"));
    	ListLeave.add(new LeaveEvent(MainTest.addDays(7), "Jessa"));
    	ListLeave.add(new LeaveEvent(MainTest.addDays(42), "Lappie"));
    	ListLeave.add(new LeaveEvent(MainTest.addDays(12), "Nexia"));
    }
    
    
    public static List<OptInEvent> ListOptIn;
    
    private void Generate_OptInEvent ()
    {
    	ListOptIn = new ArrayList<OptInEvent>();
    	
    	// Add objects
    	ListOptIn.add(new OptInEvent(MainTest.addDays(5), "Jessa", "Gass Bill"));
    }
    
    
    public static List<OptOutEvent> ListOptOut;
    
    private void Generate_OptOutEvent ()
    {
    	ListOptOut = new ArrayList<OptOutEvent>();
    	
    	// Add objects
    	ListOptOut.add(new OptOutEvent(MainTest.addDays(-2), "Jessa", "Gass Bill"));
    }
    
    
    public static List<PayEvent> ListPay;
    
    private void Generate_PayEvent ()
    {
    	ListPay = new ArrayList<PayEvent>();
    	
    	// Add objects
    	ListPay.add(new PayEvent(MainTest.addDays(2), "Marie Putri", 10000, "Jessa"));
    	ListPay.add(new PayEvent(MainTest.addDays(6), "Jessa", 12000, "Gass Bill"));
    	ListPay.add(new PayEvent(MainTest.addDays(11), "Nexia", 12000, "Telephone Bill"));
    	ListPay.add(new PayEvent(MainTest.addDays(10), "Nexia", 12000, "Marie Putri"));
    	ListPay.add(new PayEvent(MainTest.addDays(10), "Marie Putri", 10000, "Gass Bill"));
    }
    
    
    public static List<RenewLeaseEvent> ListRenewLease;
    
    private void Generate_RenewLeaseEvent ()
    {
    	ListRenewLease = new ArrayList<RenewLeaseEvent>();
    	
    	// Add objects
    	ListRenewLease.add(new RenewLeaseEvent(MainTest.addDays(80),
                "Nexia", MainTest.addDays(100)));
    	ListRenewLease.add(new RenewLeaseEvent(MainTest.addDays(30),
                "Lappie", MainTest.addDays(61)));
    }
    
    
    public static List<SetupBillEvent> ListSetupBill;
    
    private void Generate_SetupBillEvent ()
    {
    	ListSetupBill = new ArrayList<SetupBillEvent>();
    	
    	// Add objects
    	ListSetupBill.add(new SetupBillEvent(MainTest.addDays(-8),
                "Gass Bill", true, false));
    }


    public static List<StartLeaseEvent> ListStartLease;
    
    private void Generate_StartLeaseEvent ()
    {
    	ListStartLease = new ArrayList<StartLeaseEvent>();
    	
    	// Add objects
    	ListStartLease.add(new StartLeaseEvent(MainTest.addDays(0),
                "Marie Putri", 20000, "Jessa", MainTest.addDays(30), 2, 200,
                false, "Room Description New", 10000));
    	ListStartLease.add(new StartLeaseEvent(MainTest.addDays(2),
                "Marie Putri", 12000, "Alya", MainTest.addDays(20), 2, 400,
                true, "Room 223B", 7000));
    	ListStartLease.add(new StartLeaseEvent(MainTest.addDays(31),
                "Marie Putri", 25000, "Alya", MainTest.addDays(60), 1, 500,
                true, "Room 223A", 10000));
    }
    
    
    public static List<StartVacationEvent> ListStartVacation;
    
    private void Generate_StartVacationEvent ()
    {
    	ListStartVacation = new ArrayList<StartVacationEvent>();
    	
    	// Add objects
    	ListStartVacation.add(new StartVacationEvent(MainTest.addDays(6), "Marie Putri"));
    	ListStartVacation.add(new StartVacationEvent(MainTest.addDays(42), "Alya"));
    }
    

    public static List<StopVacationEvent> ListStopVacation;
    
    private void Generate_StopVacationEvent ()
    {
    	ListStopVacation = new ArrayList<StopVacationEvent>();
    	
    	// Add objects
    	ListStopVacation.add(new StopVacationEvent(MainTest.addDays(12), "Marie Putri"));
    	ListStopVacation.add(new StopVacationEvent(MainTest.addDays(61), "Alya"));
    }
    

    public static List<TransferLeaseEvent> ListTransferLease;
    
    private void Generate_TransferLeaseEvent ()
    {
    	ListTransferLease = new ArrayList<TransferLeaseEvent>();
    	
    	// Add objects
    	ListTransferLease.add(new TransferLeaseEvent(MainTest.addDays(6),
                "Jessa", "Nexia", true));
    	ListTransferLease.add(new TransferLeaseEvent(MainTest.addDays(12),
                "Nexia", "Lappie", false));
    }

}
